package com.huli.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huli.domain.PropertyCompany;
import com.huli.vo.PagePropertyCompanyVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.sql.Wrapper;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Yuri
 * @since 2020-11-10
 */
@Repository
public interface PropertyCompanyMapper extends BaseMapper<PropertyCompany> {

    @Select("SELECT\n" +
            "\tp.property_company_name, \n" +
            "\tp.property_company_id, \n" +
            "\tpd.property_company_deduct_discount\n" +
            "\tFROM\n" +
            "\tproperty_company p\n" +
            "\tLEFT JOIN\n" +
            "\tproperty_company_deduct pd\n" +
            "\tON\n" +
            "\tp.property_company_id = pd.property_company_id" +
            "\t${ew.customSqlSegment}")
    IPage<PagePropertyCompanyVO> pagePropertyCompany(IPage<PagePropertyCompanyVO> page,
                                                     @Param(Constants.WRAPPER) QueryWrapper<PagePropertyCompanyVO> queryWrapper);

}
